/*
* filename : sqliteinterface.h
* path: ./
* author: liehu1119
* date : 2013-04-06
* version : 1.0
* note : difine function which  invoke the sqlite interface. 
*/

#ifndef _SQLITEINTERFACE_
#define _SQLITEINTERFACE_

#include "sqlite3.h"

#define SQLMAXBUF   512

enum DB_ERROR_TYPE
{
	DB_ERR = 0,
    DB_ERROR = 0,
    DB_ERROR_OK,
    DB_OK = 1,
    DB_ERROR_FAILURE,
    DB_ERROR_INVALID_PARAM
};

long InitConnection(void);
long OpenConnection(char *pDBName);
long CloseConnection(sqlite3 *pDB);
long ExecSQL(char *pSql);
long GetTable(char *pSql, char ***pTableResult, int *pRow, int *pColumn);
int selectWeightTable(char *pSelect);
void ReleaseTableResult(char **pTableResult);
int weightTableNum(char *pSelect);
int showWeightTable(char *pSelect,int weightData[10]);

int TableInsertExecSQL(char *,char *,char *);
int TableDeleteExecSQL(char *,char *);
int TableUpdateExecSQL(char *,char *,char *,char *);


int LogonTable(char *,char *);//查找登录表(Name,pwd)
int selectLogonTable(char *);//查找登录表(Name)
int RFIDUpdataTable(char *,char *);//更新密码
int selectRFIDTable(char *);//name
int selectRFIDTablePwd(char *);//pwd
extern sqlite3 *g_db; 
#endif //_SQLITEINTERFACE_

/*
------------------------------------------------------------------------
yyyy-mm-dd		name		description
------------------------------------------------------------------------
2013-04-06		liuhuizhe	        init
------------------------------------------------------------------------
*/


